package flymoke.swing.jtable;

import java.awt.Component;

import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableCellRenderer;

public class CustomCellRenderer implements TableCellRenderer {

  private JTextField text;

  private BooleanCellRenderer booleanCellRenderer, booleanCellRenderer1;

  public CustomCellRenderer() {
    booleanCellRenderer = new BooleanCellRenderer();
    booleanCellRenderer1 = new BooleanCellRenderer();
    text = new JTextField();
  }

  @Override
  public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    if (column == 1) {
      if (row == 1) {
        return this.booleanCellRenderer.getTableCellRendererComponent(table, value,
          isSelected, hasFocus, row, column);
      }
      if (row == 2) {
        return this.booleanCellRenderer1.getTableCellRendererComponent(table, value,
          isSelected, hasFocus, row, column);
      } else {

        text.setEditable(true);
        text.setText((String) value);
      }
    }
    return text;
  }

}
